<?php
// FileFind - ftp/shares indexing and search php engine,
// http://project.ffind.ru
//
// Module: lib.profile.php
// Description: Support for profiling in windows
// Copyright (c) 2003-2008 Rage Steel, www.gt2.ru
// ----------------------------------------------
// $Id$

if (!extension_loaded('win32ps')) {
  if (!dl('php_win32ps.dll')) {
    die('Cannot load win32ps');
  }
}

// !!! IN DEBUG get_mem_usage
// !!!          caching share crawling listing
// !!!          must check ftp indexing (hashing, load(), etc...)
/*
if (!function_exists('memory_get_usage')) {
  function memory_get_usage() {
    if (PHP_OS == 'WINNT') {
      // Windows workaround
      $output = array();
      exec('tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $output);            
      return substr($output[5], strpos($output[5], ':') + 1);
    } else {
      return -1;
    }
  } // memory_get_usage
}

*/

function dump_memory_usage() {
  $proc_stat = win32_ps_stat_proc();
  print_r($proc_stat['mem']);
} // dump_memory_usage

// get_mem_usage(
//print_r(win32_ps_stat_proc());
?>